from datetime import datetime

from src.baseapp.model import db, CustomDbModel


class DeviceModel(CustomDbModel):
    __tablename__ = 'device'

    device_id = db.Column(db.Integer, primary_key=True, autoincrement=True)

    # 设备名称
    name = db.Column(db.String(255), nullable=False)

    # 设备型号id
    model_id = db.Column(db.Integer, nullable=False)

    # 设备imei
    imei = db.Column(db.Char(15), nullable=False)

    # 设备端口，表示在那个端口上接受信令
    port = db.Column(db.Integer, nullable=False)

    # 设备ip 通常是本机ip地址
    ip = db.Column(db.String(255), nullable=False)

    # 设备状态 1为离线 0为在线
    status = db.Column(db.Integer, nullable=False, default=1)
